﻿

function ng_cppei_inputValidate(app) {

    // console.log('dfefew');
    app.directive("validatestr", function () {
        return {
            restrict: 'E',
            template: function (tElement, tAttrs) {
                // debugger;
                var _html = '';
                _html += '<div>' + tAttrs.title + '</div>';
                return _html;
            },
            replace: true
        }
    });

    app.directive("validatedate", function ($document) {
        //debugger;
        return {
            restrict: 'E',
            template: function (tElement, tAttrs) {
                //debugger;
                var _html = '';
                if (tAttrs.type == "") {
                    _html = '<div class="input-group">'
                          + ' <span class="input-group-addon">'
                          + '<i class="icon-calendar bigger-110"></i> </span>'
                          + ' <span class="input-icon input-icon-right">'
                          + ' <input id="' + tAttrs.id + '" name="' + tAttrs.id + ' " class=" date-picker" type="text" required value="{{' + tAttrs.value + '}}" ng-model="' + tAttrs.value + '" data-date-format="yyyy-mm-dd" />'
                          + '<i ng-class="(validateForm.' + tAttrs.id + '.$dirty && validateForm.' + tAttrs.id + '.$valid)?\'icon-ok-sign green\':\'icon-remove-sign red\'"></i>'
                          + ' </span></div>';
                } else if (tAttrs.type == "") {
                
                }
               
                return _html;
            },
            replace: true
        }
    });

    app.filter("inputtype", function () {
        return function (input, id, value) {
            var staturStr = '';
            switch (input) {
                case 1:
                    staturStr = '<validatedate id="' + id + '" value="' + name + '" ></validatedate>';
                    break;
                case 2:
                    staturStr = '已发送';
                    break;
                case 3:
                    staturStr = '发送失败';
                    break;
            }

            return staturStr;
        }
    });

    app.filter("temptype", function () {
        return function (input, id, value) {
            var staturStr = '';
            switch (input) {
                case 1:
                    staturStr = id + value;
                    break;
                case 2:
                    staturStr = '已发送';
                    break;
                case 3:
                    staturStr = '发送失败';
                    break;
            }

            return staturStr;
        }
    });


}